package com.yanqu.road.handle;

import com.yanqu.road.NettyMgr;
import com.yanqu.road.connect.AgentServerConnectionGroup;
import com.yanqu.road.utils.ReconnectUtils;
import io.netty.channel.ChannelHandlerContext;

public class AgentConnectionCloseHandle {

    public static void handle(ChannelHandlerContext ctx) {
        AgentServerConnectionGroup connectionGroup = (AgentServerConnectionGroup) ctx.channel().attr(NettyMgr.LINKED_CLIENT).get();
        if (connectionGroup != null) {
            ReconnectUtils.getInstance().reconnect(connectionGroup, 10);
        }
    }
}
